<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .active {
      color: red;
    }
  </style>
</head>

<body>
  <div id="app">
    <name-age :list='heroList'>
      <template slot-scope='hefa'>
        <p :class='hefa.horg.id === 2? "active" : "" '>{{hefa.horg.name}}</p>
      </template>
    </name-age>
  </div>
  <script src="../vue.js"></script>
  <script>
    Vue.component('name-age', {
      props: ['list'],
      template: `
        <div>
          <p>说了再见</p>
          <li v-for='item in list' :key='item.id'>
            <slot :horg='item'></slot>
          </li>
        </div>
      `
    })

    var vm = new Vue({
      el: '#app',
      data: {
        heroList: [
          {
            id: 1,
            name: '亚瑟'
          },
          {
            id: 2,
            name: '蒙恬'
          },
          {
            id: 3,
            name: '妲己'
          }
        ]
      },

    })
  </script>
</body>

</html>